package com.example.demo.设计模式.原型模式;

import java.io.*;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @projectName:demo
 * @see:设计模式.原型模式
 * @author:袁成龙
 * @createTime:2020/10/13 8:11
 * @version:1.0
 */
public class YuanXingTest implements Cloneable,Serializable{


    private List<Map<String,List<String>>> maps;

    private Integer i;

    private int in;

    public List<Map<String, List<String>>> getMaps() {
        return maps;
    }

    public Integer getI() {
        return i;
    }

    public int getIn() {
        return in;
    }

    public void setMaps(List<Map<String, List<String>>> maps) {
        this.maps = maps;
    }

    public void setI(Integer i) {
        this.i = i;
    }

    public void setIn(int in) {
        this.in = in;
    }

    //浅克隆
    @Override
    protected YuanXingTest clone() throws CloneNotSupportedException {

        return (YuanXingTest)super.clone();
    }


    //浅克隆
    protected YuanXingTest deptclone() throws IOException, ClassNotFoundException {

        ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
        ObjectOutputStream outputStream = new ObjectOutputStream(arrayOutputStream);
        outputStream.writeObject(this);
        ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(arrayOutputStream.toByteArray());
        ObjectInputStream inputStream = new ObjectInputStream(arrayInputStream);
        inputStream.close();
        return  (YuanXingTest)inputStream.readObject();
       //

    }
}